﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.AdminCP;
using SES.CMS.BL;
using System.Data;

namespace SES.CMS
{
    public partial class Topbike : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            string pass = Functions.EncryptMd5(txtPass.Text.Trim());
            DataTable dtUser = new cmsCustomerBL().SelectLogin(txtUser.Text.Trim(), pass);
            if (dtUser.Rows.Count > 0)
            {
                Session["FullName"] = dtUser.Rows[0]["FullName"].ToString();
                Session["CustomerID"] = dtUser.Rows[0]["ID"].ToString();
                string urlReturn = "";
                if (Request.QueryString["ReturnURL"] != null)
                    urlReturn = Request.QueryString["ReturnURL"].ToString();
                if (string.IsNullOrEmpty(urlReturn))
                    Response.Redirect("~/");
                else
                    Response.Redirect(urlReturn);
            }
            else
            {
                Functions.Alert("Sai tên đăng nhập hoặc mật khẩu!!!", "Login.aspx");
            }
        }

        protected void btnHuy_Click(object sender, EventArgs e)
        {

        }
    }
}